/**
 * Copyright &copy; 2013-2015 山东易科德软件有限公司   All rights reserved.
 */
package cn.net.ecode.modules.sys.entity;

import cn.net.ecode.common.persistence.annotation.Id;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import cn.net.ecode.common.persistence.TreeEntity;

/**
 * 用户字典管理Entity
 * @author ThinkGem
 * @version 2015-07-27
 */
public class UserDict extends TreeEntity<UserDict> {
	
	private static final long serialVersionUID = 1L;
	private String dictCode;		// 用户字典编码
	private Integer sortGrade;		// 级别
	private String dictName;		// 字典名
	private String dictValue;		// 字典值
	private String dictTypeCode;		// 字典类型
	private String dictTypeName;		// 字典类型名称
	private String description;		// 描述
	private String cssStyle;		// css样式（如：color:red)
	private String cssClass;		// css类名（如：red）
	
	public UserDict() {
		super();
	}

	public UserDict(String dictCode){
		super();
		this.dictCode = dictCode;
	}

	public UserDict(UserDict parent){
		this.parent = parent;
	}
		
	@Id
	public String getDictCode() {
		return dictCode;
	}

	public void setDictCode(String dictCode) {
		this.dictCode = dictCode;
	}
		
	@JsonBackReference
	@NotNull(message="父级编号不能为空")
	public UserDict getParent() {
		return parent;
	}

	public void setParent(UserDict parent) {
		this.parent = parent;
	}
		
	public Integer getSortGrade() {
		return sortGrade;
	}

	public void setSortGrade(Integer sortGrade) {
		this.sortGrade = sortGrade;
	}
		
	@Length(min=0, max=100, message="字典名长度不能大于 100 个字符")
	public String getDictName() {
		return dictName;
	}

	public void setDictName(String dictName) {
		this.dictName = dictName;
	}

	/**
	 * 字典名，同 getDictName()
	 */
	public String getName() {
		return dictName;
	}
	
	/**
	 * 字典名，同 getDictName()
	 */
	public String getLabel() {
		return dictName;
	}
	
	@Length(min=0, max=100, message="字典值长度不能大于 100 个字符")
	public String getDictValue() {
		return dictValue;
	}

	public void setDictValue(String dictValue) {
		this.dictValue = dictValue;
	}
	
	/**
	 * 字典值，同 getDictValue()
	 */
	public String getValue() {
		return dictName;
	}
	
	@Length(min=0, max=100, message="字典类型长度不能大于 100 个字符")
	public String getDictTypeCode() {
		return dictTypeCode;
	}

	public void setDictTypeCode(String dictTypeCode) {
		this.dictTypeCode = dictTypeCode;
	}
		
	public String getDictTypeName() {
		return dictTypeName;
	}

	public void setDictTypeName(String dictTypeName) {
		this.dictTypeName = dictTypeName;
	}

	@Length(min=0, max=100, message="描述长度不能大于 100 个字符")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
		
	@Length(min=0, max=500, message="css样式（如：color:red)长度不能大于 500 个字符")
	public String getCssStyle() {
		return cssStyle;
	}

	public void setCssStyle(String cssStyle) {
		this.cssStyle = cssStyle;
	}
		
	@Length(min=0, max=500, message="css类名（如：red）长度不能大于 500 个字符")
	public String getCssClass() {
		return cssClass;
	}

	public void setCssClass(String cssClass) {
		this.cssClass = cssClass;
	}
	
	public String toString() {
		return dictCode;
	}
}